; Music of Operation Hanoi (1990) (Players)
; Ripped by Megachur the 18/01/2007

	write "OPERATIH.BIN"

music_date_rip	equ &1217
music_adr	equ &0500
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"
	
	jp l0d85	; init music
	jp l0e68	; play music

.l0508 equ $ + 2
.music_end equ $ + 1
.l0507 equ $ + 1
.l0506
	db #00,#01,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#ff,#00,#00,#00,#01
	db #00,#0c,#00,#0c,#00,#00,#18,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#0f,#08
	db #00,#00,#0f,#00,#00,#fb,#ff,#00
	db #00,#03,#04,#24,#18,#12,#0c,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#78,#00,#00,#00,#00
	db #00,#0f,#0f,#00,#fe,#0d,#00,#00
	db #ff,#ff,#00,#00,#03,#06,#00,#fc
	db #f4,#f4,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#e8,#00
	db #00,#00,#00,#00,#0f,#08,#00,#ff
	db #0c,#14,#05,#ff,#ff,#00,#00,#02
	db #03,#0c,#0c,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#0f
	db #08,#00,#ff,#0c,#14,#06,#ff,#ff
	db #00,#00,#00,#01,#0c,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#0f,#0a,#00,#ff,#0a,#01
	db #01,#ff,#ff,#00,#00,#00,#03,#00
	db #03,#07,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#0f,#0a,#00
	db #ff,#0a,#01,#01,#ff,#ff,#00,#00
	db #00,#03,#00,#05,#09,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #0f,#0a,#00,#ff,#0a,#01,#01,#ff
	db #ff,#00,#00,#00,#03,#00,#04,#07
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#0a,#0a,#00,#00,#0a
	db #00,#00,#fc,#01,#14,#64,#03,#04
	db #00,#fc,#f8,#f4,#e8,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #b8,#00,#00,#00,#00,#08,#0f,#01
	db #01,#00,#0f,#01,#05,#ff,#ff,#00
	db #00,#00,#01,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#62,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#0f,#08,#00,#ff
	db #0c,#14,#06,#ff,#ff,#00,#00,#00
	db #03,#00,#03,#07,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#0f
	db #08,#00,#ff,#0c,#14,#06,#ff,#ff
	db #00,#00,#00,#03,#00,#04,#07,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#0f,#08,#00,#ff,#0c,#14
	db #06,#ff,#ff,#00,#00,#00,#03,#00
	db #05,#09,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #0d,#08,#00,#ff,#0b,#14,#03,#ff
	db #ff,#00,#00,#00,#01,#0c,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#0f,#08,#00,#ff,#0d
	db #02,#02,#ff,#ff,#00,#00,#00,#01
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00
.l075b
	dw l07ab,l07d0,l07e6,l0822
	dw l082b,l0830,l0835,l0842
	dw l084b,l0850,l0857,l085a
.l0773
	dw l085d,l086c,l088f,l08c6
	dw l091b,l0944,l0963,l0984
	dw l09ad,l09d4,l0a27,l0a46
	dw l0a87,l0ab4,#0000,l0ac3
	dw l0ad8,l0ae9,l0b08,l0b17
	dw l0b3a,l0bad,l0bf6,#0000
	dw #0000,l0c0d,l0c1e,l0c35
.l07ab
	db #fc,#00,#fb,#18,#02,#03,#08,#01
	db #02,#07,#08,#01,#02,#08,#fa,#f4
	db #04,#01,#01,#01,#04,#01,#01,#01
	db #fa,#0c,#f9,#01,#03,#04,#f9,#00
.l07d0 equ $ + 5
	db #02,#04,#0f,#04,#fd,#09,#03,#0a
	db #01,#03,#07,#0a,#01,#03,#0f,#0a
	db #01,#03,#04,#10,#03,#11,#01,#12
.l07e6 equ $ + 3
	db #01,#00,#ff,#00,#04,#04,#01,#01
	db #01,#04,#01,#07,#01,#0c,#03,#0d
	db #01,#05,#01,#06,#01,#05,#01,#0b
	db #01,#04,#01,#01,#01,#04,#01,#07
	db #01,#04,#04,#05,#01,#06,#01,#05
	db #01,#0b,#01,#04,#01,#01,#01,#04
	db #01,#07,#01,#04,#01,#01,#01,#04
.l0822 equ $ + 7
	db #01,#07,#01,#00,#01,#00,#ff,#fc
	db #00,#fb,#18,#19,#01,#00,#01,#ff
.l0830 equ $ + 5
.l082b
	db #1a,#01,#00,#01,#ff,#1b,#01,#00
.l0835 equ $ + 2
	db #01,#ff,#fc,#00,#fb,#18,#f9,#02
.l0842 equ $ + 7
	db #16,#01,#f9,#00,#00,#01,#ff,#fa
	db #0c,#16,#01,#fa,#f4,#00,#01,#ff
.l0850 equ $ + 5
.l084b
	db #16,#01,#00,#01,#ff,#fc,#00,#fb
.l085a equ $ + 7
.l0857 equ $ + 4
	db #18,#13,#01,#ff,#14,#01,#ff,#15
.l085d equ $ + 2
	db #01,#ff,#61,#00,#60,#10,#60,#10
	db #60,#10,#60,#10,#60,#10,#60,#10
.l086c equ $ + 1
	db #fe,#61,#03,#40,#03,#61,#00,#19
	db #09,#61,#03,#3d,#10,#60,#0e,#3d
	db #03,#3f,#03,#40,#06,#3f,#06,#40
	db #06,#3f,#06,#42,#06,#40,#06,#3d
.l088f equ $ + 4
	db #06,#3b,#06,#fe,#61,#04,#25,#06
	db #25,#06,#25,#03,#23,#03,#24,#03
	db #25,#03,#61,#00,#19,#12,#61,#04
	db #25,#03,#27,#03,#28,#06,#34,#03
	db #28,#03,#61,#00,#19,#09,#61,#04
	db #28,#03,#2a,#03,#28,#03,#2a,#06
	db #28,#03,#61,#00,#19,#03,#61,#04
.l08c6 equ $ + 3
	db #2a,#06,#fe,#61,#01,#19,#06,#61
	db #05,#49,#03,#49,#03,#61,#02,#19
	db #06,#61,#05,#49,#03,#49,#03,#61
	db #01,#19,#06,#61,#06,#47,#03,#61
	db #05,#49,#03,#61,#02,#19,#06,#61
	db #05,#49,#03,#49,#03,#61,#01,#19
	db #06,#61,#07,#4c,#03,#4c,#03,#61
	db #02,#19,#06,#61,#07,#4c,#03,#4c
	db #03,#61,#01,#19,#06,#61,#06,#49
	db #03,#49,#03,#61,#02,#19,#06,#61
	db #06,#49,#03,#49,#03,#61,#01,#fe
.l091b
	db #61,#03,#40,#03,#61,#00,#19,#09
	db #61,#03,#3d,#10,#60,#0e,#3d,#03
	db #3f,#03,#40,#06,#3f,#03,#61,#00
	db #19,#03,#61,#03,#3d,#03,#61,#00
	db #19,#03,#61,#03,#42,#10,#60,#0e
.l0944 equ $ + 1
	db #fe,#61,#03,#44,#0c,#44,#0c,#fa
	db #00,#ff,#44,#06,#fa,#00,#00,#44
	db #06,#42,#06,#44,#10,#60,#0e,#42
	db #06,#40,#06,#42,#06,#40,#06,#fe
.l0963
	db #61,#03,#44,#0c,#44,#0c,#fa,#00
	db #ff,#44,#06,#fa,#00,#00,#44,#06
	db #42,#06,#44,#10,#60,#08,#3d,#06
	db #40,#06,#3d,#06,#40,#06,#3d,#06
.l0984 equ $ + 1
	db #fe,#61,#03,#49,#09,#47,#09,#4c
	db #06,#49,#12,#3d,#03,#3d,#03,#40
	db #06,#3d,#03,#61,#00,#19,#09,#61
	db #03,#42,#06,#40,#03,#61,#00,#19
	db #09,#61,#03,#44,#03,#47,#03,#49
.l09ad equ $ + 2
	db #06,#fe,#61,#04,#fa,#00,#04,#25
	db #10,#60,#08,#fa,#00,#00,#61,#00
	db #19,#10,#60,#08,#61,#01,#25,#06
	db #25,#06,#25,#03,#25,#06,#22,#06
	db #22,#06,#22,#03,#1e,#06,#1b,#06
.l09d4 equ $ + 1
	db #fe,#61,#01,#19,#06,#61,#00,#49
	db #03,#49,#03,#61,#02,#19,#06,#61
	db #00,#49,#03,#49,#03,#61,#01,#19
	db #06,#61,#00,#47,#03,#49,#03,#61
	db #02,#19,#06,#61,#00,#49,#03,#49
	db #03,#61,#01,#19,#06,#61,#00,#4c
	db #03,#4c,#03,#61,#02,#19,#06,#61
	db #00,#4c,#03,#4c,#03,#61,#01,#19
	db #06,#61,#00,#49,#03,#49,#03,#61
	db #02,#19,#06,#61,#00,#49,#03,#49
.l0a27 equ $ + 4
	db #03,#61,#01,#fe,#61,#01,#31,#10
	db #60,#10,#60,#10,#60,#10,#60,#08
	db #61,#08,#31,#03,#31,#03,#31,#03
	db #31,#03,#31,#03,#31,#03,#31,#03
.l0a46 equ $ + 3
	db #31,#03,#fe,#61,#03,#44,#09,#40
	db #09,#3d,#10,#60,#08,#61,#03,#44
	db #03,#44,#03,#fa,#00,#ff,#42,#06
	db #fa,#00,#00,#44,#03,#44,#03,#fa
	db #00,#ff,#42,#06,#fa,#00,#00,#44
	db #03,#44,#03,#47,#03,#61,#00,#19
	db #03,#61,#03,#44,#03,#61,#00,#19
	db #03,#61,#03,#fa,#00,#14,#49,#0c
.l0a87 equ $ + 4
	db #fa,#00,#00,#fe,#61,#01,#25,#09
	db #25,#09,#22,#03,#22,#03,#20,#06
	db #1d,#06,#1b,#06,#19,#06,#61,#08
	db #19,#03,#19,#03,#19,#03,#19,#03
	db #19,#03,#19,#03,#19,#03,#19,#03
	db #61,#01,#19,#09,#19,#09,#19,#06
.l0ab4 equ $ + 1
	db #fe,#61,#09,#60,#10,#60,#10,#60
	db #10,#60,#10,#60,#10,#60,#10,#fe
.l0ac3
	db #61,#0c,#49,#10,#60,#10,#60,#10
	db #61,#0c,#4c,#10,#60,#08,#61,#0d
.l0ad8 equ $ + 5
	db #49,#10,#60,#08,#fe,#61,#04,#25
	db #10,#60,#10,#60,#10,#28,#10,#60
.l0ae9 equ $ + 6
	db #08,#2a,#10,#60,#08,#fe,#61,#04
	db #25,#06,#23,#06,#25,#06,#61,#00
	db #19,#12,#61,#04,#23,#06,#25,#06
	db #28,#0c,#2a,#0c,#2c,#06,#2a,#06
.l0b08 equ $ + 5
	db #2c,#06,#2f,#06,#fe,#61,#04,#25
	db #10,#60,#10,#60,#10,#60,#10,#60
.l0b17 equ $ + 4
	db #10,#60,#10,#fe,#61,#03,#38,#10
	db #60,#10,#60,#10,#33,#10,#60,#10
	db #60,#10,#3f,#10,#60,#08,#3d,#0c
	db #3f,#0c,#38,#0c,#36,#0c,#38,#10
.l0b3a equ $ + 7
	db #60,#10,#60,#10,#60,#10,#fe,#61
	db #04,#2c,#04,#61,#0f,#2c,#04,#2c
	db #04,#61,#04,#2c,#04,#61,#0f,#2c
	db #04,#2c,#04,#61,#04,#2c,#04,#61
	db #0f,#2c,#04,#2c,#04,#61,#04,#2c
	db #04,#2a,#04,#2b,#04,#2c,#04,#61
	db #0f,#2c,#04,#2c,#04,#61,#04,#2c
	db #04,#61,#0f,#2c,#04,#2c,#04,#61
	db #04,#2c,#04,#61,#0f,#2c,#04,#2c
	db #04,#61,#04,#2c,#04,#2a,#04,#2b
	db #04,#2f,#04,#61,#0f,#2f,#04,#2f
	db #04,#61,#04,#2f,#04,#61,#0f,#2e
	db #04,#2f,#04,#61,#04,#33,#08,#31
	db #08,#2f,#08,#2c,#10,#60,#08,#2c
	db #10,#60,#08,#60,#10,#60,#10,#60
.l0bad equ $ + 2
	db #10,#fe,#61,#05,#44,#08,#44,#08
	db #61,#00,#19,#08,#61,#05,#44,#08
	db #44,#08,#44,#08,#44,#08,#44,#08
	db #61,#00,#19,#08,#61,#05,#44,#08
	db #44,#08,#44,#08,#61,#07,#47,#08
	db #47,#08,#61,#00,#19,#08,#61,#07
	db #49,#08,#49,#08,#61,#00,#19,#08
	db #61,#05,#50,#0c,#61,#06,#4e,#0c
	db #61,#05,#50,#10,#60,#10,#60,#10
.l0bf6 equ $ + 3
	db #60,#10,#fe,#61,#04,#3d,#09,#3d
	db #03,#3d,#06,#44,#06,#3d,#06,#44
	db #06,#49,#12,#60,#10,#60,#10,#60
.l0c0d equ $ + 2
	db #10,#fe,#61,#10,#3d,#0c,#3f,#0c
	db #3f,#0c,#3b,#0c,#3d,#10,#60,#08
.l0c1e equ $ + 3
	db #3d,#10,#fe,#61,#00,#19,#06,#61
	db #10,#40,#0c,#3d,#0c,#3d,#0c,#38
	db #12,#3b,#0c,#38,#10,#60,#10,#60
.l0c35 equ $ + 2
	db #10,#fe,#61,#0d,#44,#10,#60,#08
	db #61,#0b,#44,#10,#60,#08,#61,#0d
	db #44,#10,#60,#10,#60,#10,#60,#10
.l0c4e equ $ + 3
.l0c4d equ $ + 2
.l0c4c equ $ + 1
	db #fe,#00,#00,#00,#00,#00,#00,#00
.l0c5a equ $ + 7
.l0c59 equ $ + 6
	db #00,#30,#30,#30,#30,#00,#0f,#00
.l0c5d equ $ + 2
.l0c5c equ $ + 1
.l0c5b
	db #00,#00,#00,#00
.l0c5f
	ld a,(l0c5b)
	and a
	ld b,a
	ret z
	ld a,(l0c5d)
	cp #80
	jp z,l0c88
	ld a,(l0c5c)
	dec a
	ld (l0c5c),a
	ret nz
	ld a,(l0c5d)
	ld (l0c5c),a
	ld a,(l0c59)
	add b
	bit 4,a
	jp nz,l0c97
	ld (l0c59),a
	ret
.l0c88
	ld a,b
	cp #01
	ld a,#0f
	jp z,l0c91
	xor a
.l0c91
	ld (l0c59),a
	jp l0c97
.l0c97
	xor a
	ld (l0c5b),a
	ld a,(l0c5a)
	and a
	jp nz,l0e34
	ret
.l0ca3
	ld a,#00
	ld (l0c59),a
	ld a,#01
.l0caa
	ld (l0c5b),a
	inc hl
	ld a,(hl)
	ld (l0c5d),a
	ld (l0c5c),a
	inc hl
	ret
.l0cb7
	ld a,#0f
	ld (l0c59),a
	ld a,#ff
	jp l0caa
.l0cc1
	ld a,h
	push af
	ld c,l
	cp #07
	jp nz,l0ccd
	res 7,c
	res 6,c
.l0ccd
	ld a,#c0
	ld b,#f6
	out (c),a
	ld b,#f4
	pop af
	out (c),a
	ld b,#f6
	ld a,#80
	out (c),a
	ld b,#f4
	out (c),c
	xor a
	ld b,#f6
	out (c),a
	ret
.l0cef equ $ + 7
.l0cee equ $ + 6
.l0ce9 equ $ + 1
.l0ce8
	db #00,#01,#00,#00,#00,#00,#00,#f8
.l0cf5 equ $ + 5
.l0cf3 equ $ + 3
.l0cf2 equ $ + 2
.l0cf1 equ $ + 1
.l0cf0
	db #0f,#0f,#0f,#00,#00,#00,#00,#00
	db #0c,#05,#00,#08,#01,#ff,#00,#00
	db #00,#01,#08,#00,#00,#04,#00,#00
	db #00,#00,#00,#f7,#14,#0a,#01,#00
	db #00,#08,#04,#00,#00,#01,#00,#00
	db #00,#0a,#00,#02,#00,#fe,#00,#00
.l0d24 equ $ + 4
.l0d22 equ $ + 2
.l0d20
	db #00,#00,#00,#00,#00,#00,#00,#0f
	db #01,#01,#02,#01,#ff,#00,#00,#02
	db #03,#09,#00,#00,#01,#00,#00,#00
	db #00,#00,#ef,#ff,#ff,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l0d4f equ $ + 7
	db #00,#00,#00,#00,#00,#00,#00,#00
.l0d53 equ $ + 3
.l0d51 equ $ + 1
	db #00,#00,#00,#00,#00,#00,#0f,#0a
	db #01,#02,#02,#ff,#00,#00,#04,#05
	db #0a,#00,#00,#00,#01,#00,#00,#00
	db #00,#00,#df,#ff,#ff,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l0d7e equ $ + 6
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00
;
.init_music
.l0d85
;
	ld a,#0f
	ld (l0c59),a
	xor a
	ld (l0c5b),a
	ld (l0c5a),a
	call l0e3c
	ld a,(l0c4d)
	cp #ff
	jp nz,l0da0
	inc a
	ld (l0c4d),a
.l0da0
	ld a,#01
	ld (l0cf5),a
	ld (l0d24),a
	ld (l0d53),a
	xor a
	ld (l0c4c),a
	push ix
	ld ix,l0cf3
	ld a,(l0c4d)
	add a
	ld b,a
	add a
	add b
	ld l,a
	ld h,#00
	ld de,l075b
	add hl,de
	ld (l0dd1),hl
	inc hl
	inc hl
	ld (l0ddb),hl
	inc hl
	inc hl
	ld (l0de5),hl
.l0dd1 equ $ + 1
	ld hl,(#0000)
	call l0e0a
	ld ix,l0d22
.l0ddb equ $ + 1
	ld hl,(#0000)
	call l0e0a
	ld ix,l0d51
.l0de5 equ $ + 1
	ld hl,(#0000)
	call l0e0a
	ld a,#01
	ld (l0507),a
	ld h,#07
	ld l,#f8
	call l0cc1
	ld a,(l0c4d)
	cp #01
	pop ix
	ret
.l0dfe			; test player
	halt
	call l0e68
	ld a,(l0507)
	and a
	jp nz,l0dfe
	ret
.l0e0a
	ld (ix+#20),l
	ld (ix+#23),l
	ld (ix+#00),l
	ld (ix+#21),h
	ld (ix+#24),h
	ld (ix+#01),h
	call l131a
	ld (ix+#02),#01
	ld (ix+#0c),#00
	ld (ix+#05),#00
	ld (ix+#04),#00
	ld (ix+#17),#00
	ret
;
.stop_music
.l0e34
;
	call l0e3c
	xor a
	ld (l0507),a
	ret
.l0e3c
	ld h,#07
	ld l,#ff
	call l0cc1
	ld hl,l0ce8
	ld de,l0ce9
	ld bc,#000a
	ld (hl),#00
	ldir
	ld a,#f8
	ld (l0cef),a
.l0e55
	ld b,#0b
	ld h,#00
	ld de,l0ce8
.l0e5c
	ld a,(de)
	ld l,a
	push bc
	call l0cc1
	pop bc
	inc h
	inc de
	djnz l0e5c
	ret
;
.play_music
.l0e68
;
	ld a,(l0506)
	and a
	jp z,l0ea0
	ld b,a
	xor a
	ld (l0506),a
	ld a,b
	cp #ff
	jp z,l0e34
	cp #fe
	jp nz,l0e99
	ld b,#0a
	ld a,#01
	ld (l0c5a),a
	call l0e8c
	jp l0ea0
.l0e8c
	ld a,#ff
	ld (l0c5b),a
	ld a,b
	ld (l0c5d),a
	ld (l0c5c),a
	ret
.l0e99
	dec a
	ld (l0c4d),a
	jp l0d85
.l0ea0
	call l0c5f
	ld a,(l0507)
	and a
	jr z,l0f02
	push ix
	ld ix,l0cf3
	bit 7,(ix+#0c)
	call z,l0f03
	ld ix,l0d22
	bit 7,(ix+#0c)
	call z,l0f03
	ld ix,l0d51
	bit 7,(ix+#0c)
	call z,l0f03
	ld a,(l0c59)
	cpl
	and #0f
	ld b,a
	ld a,(l0c4c)
	and a
	ld a,#10
	jp nz,l0ee4
	ld a,(l0cf0)
	sub b
	jp nc,l0ee4
	xor a
.l0ee4
	ld (l0cf0),a
	ld a,(l0cf1)
	sub b
	jp nc,l0eef
	xor a
.l0eef
	ld (l0cf1),a
	ld a,(l0cf2)
	sub b
	jp nc,l0efa
	xor a
.l0efa
	ld (l0cf2),a
	call l0e55
	pop ix
.l0f02
	ret
.l0f03
	ld a,(ix+#02)
	dec (ix+#02)
	jp z,l10aa
.l0f0c
	ld a,(ix+#0c)
	and #03
	jp z,l0fcc
	cp #01
	jp z,l0f26
	cp #02
	jp z,l0f66
	cp #03
	jp z,l0fb0
	jp l0ffd
.l0f26
	ld a,(ix+#0b)
	and a
	jr z,l0f32
	dec (ix+#0b)
	jp l0ffd
.l0f32
	ld a,(ix+#04)
	ld b,(ix+#08)
	add b
	ld (ix+#04),a
	ld b,(ix+#05)
	cp b
	jr z,l0f53
	jr nc,l0f4d
	ld a,(ix+#07)
	ld (ix+#0b),a
	jp l0ffd
.l0f4d
	ld a,(ix+#05)
	ld (ix+#04),a
.l0f53
	ld a,(ix+#0c)
	and #fc
	or #02
	ld (ix+#0c),a
	ld a,(ix+#09)
	ld (ix+#25),a
	jp l0ffd
.l0f66
	ld a,(ix+#25)
	and a
	jr z,l0f72
	dec (ix+#25)
	jp l0ffd
.l0f72
	ld a,(ix+#04)
	ld b,(ix+#0a)
	add b
	ld (ix+#04),a
	bit 7,a
	jp nz,l0f91
	ld b,(ix+#26)
	cp b
	jr z,l0f9e
	jr c,l0f98
	ld a,(ix+#09)
	ld (ix+#25),a
	jr l0ffd
.l0f91
	ld (ix+#04),#00
	jp l0f9e
.l0f98
	ld a,(ix+#26)
	ld (ix+#04),a
.l0f9e
	ld a,(ix+#0c)
	and #fc
	or #03
	ld (ix+#0c),a
	ld a,(ix+#06)
	ld (ix+#27),a
	jr l0ffd
.l0fb0
	ld a,(ix+#27)
	and a
	jr z,l0fbb
	dec (ix+#27)
	jr l0ffd
.l0fbb
	ld a,(ix+#0c)
	and #fc
	ld (ix+#0c),a
	ld a,(ix+#2a)
	ld (ix+#29),a
	jp l0ffd
.l0fcc
	ld a,(ix+#29)
	and a
	jr z,l0fd7
	dec (ix+#29)
	jr l0ffd
.l0fd7
	ld a,(ix+#04)
	ld b,(ix+#28)
	add b
	ld (ix+#04),a
	bit 7,a
	jr nz,l0fed
	ld a,(ix+#2a)
	ld (ix+#29),a
	jr l0ffd
.l0fed
	ld (ix+#04),#00
	ld a,(ix+#0c)
	and #fc
	or #03
	ld (ix+#0c),a
	jr l0ffd
.l0ffd
	ld a,(ix+#04)
	ld hl,l0ce8
	ld d,#00
	ld e,(ix+#0f)
	add hl,de
	ld (hl),a
	ld h,(ix+#14)
	ld l,(ix+#13)
	ld d,#00
	ld e,(ix+#10)
	add hl,de
	ld a,(ix+#03)
	push af
	ld a,(hl)
	add (ix+#03)
	ld (ix+#03),a
	call l1141
	pop af
	ld (ix+#03),a
	inc (ix+#10)
	ld a,(ix+#12)
	xor (ix+#10)
	jr nz,l1039
	ld a,(ix+#11)
	ld (ix+#10),a
.l1039
	ld a,(ix+#1a)
	cp #ff
	jr z,l107a
	and a
	jr z,l1048
	dec (ix+#1a)
	jr nz,l107a
.l1048
	dec (ix+#1f)
	jr nz,l105b
	ld a,(ix+#1e)
	ld (ix+#1f),a
	ld a,(ix+#2e)
	xor #01
	ld (ix+#2e),a
.l105b
	ld b,#00
	ld c,(ix+#1b)
	ld h,(ix+#1d)
	ld l,(ix+#1c)
	bit 0,(ix+#2e)
	jr z,l106f
	add hl,bc
	jr l1071
.l106f
	sbc hl,bc
.l1071
	ld (ix+#1d),h
	ld (ix+#1c),l
	call l1095
.l107a
	ld a,(ix+#2b)
	call l1088
	and a
	call nz,l1095
	ld a,(ix+#02)
	ret
.l1088
	ld l,a
	ld h,#00
	bit 7,a
	ret z
	ld d,h
	ld e,l
	sbc hl,de
	sbc hl,de
	ret
.l1095
	ld b,h
	ld c,l
	ld hl,l0ce8
	ld d,#00
	ld e,(ix+#0d)
	add hl,de
	ld e,(hl)
	inc hl
	ld d,(hl)
	ex de,hl
	add hl,bc
	ex de,hl
	ld (hl),d
	dec hl
	ld (hl),e
	ret
.l10aa
	ld l,(ix+#00)
	ld h,(ix+#01)
.l10b0
	ld a,(hl)
	cp #60
	jp z,l113f
	cp #61
	jp z,l1204
	cp #62
	jp z,l11e2
	cp #64
	jp z,l1190
	cp #65
	jp z,l11d4
	cp #fa
	jp z,l11a7
	cp #fc
	jp z,l0ca3
	cp #fd
	jp z,l0cb7
	cp #fe
	jp z,l11e6
	cp #ff
	jp z,l11cc
	ld b,a
	ld a,(ix+#0c)
	and #fc
	or #01
	ld (ix+#0c),a
	ld (ix+#10),#00
	ld (ix+#04),#00
	ld a,b
	sub (ix+#2d)
	ld (ix+#03),a
	ld a,(ix+#19)
	ld (ix+#1a),a
	ld a,(ix+#1e)
	srl a
	ld (ix+#1f),a
	ld (ix+#1d),#00
	ld (ix+#1c),#00
.l1113
	inc hl
	ld a,(hl)
	dec a
	push hl
	ld h,#00
	ld l,a
	ld de,(l0c4e)
	add hl,de
	ld a,(hl)
	pop hl
	inc hl
	ld b,(ix+#2c)
	add b
	ld (ix+#2c),#00
	ld (ix+#02),a
	ld a,(ix+#07)
	ld (ix+#0b),a
	ld (ix+#00),l
	ld (ix+#01),h
	call l1141
	jp l0f0c
.l113f
	jr l1113
.l1141
	ld a,(ix+#17)
	and a
	call nz,l1185
	ld a,(ix+#03)
	inc a
	inc a
	add a
	ld d,#00
	ld e,a
	ld hl,l137e
	add hl,de
	push hl
	ld c,(hl)
	inc hl
	ld b,(hl)
	ld hl,l0ce8
	ld d,#00
	ld e,(ix+#0d)
	add hl,de
	ld (hl),c
	inc hl
	ld (hl),b
	pop hl
	ld a,(l0c4c)
	and a
	ret z
	ld a,(ix+#0f)
	cp #08
	ret nz
	ld de,#00c0
	add hl,de
	ex de,hl
	ld h,#0b
	ld a,(de)
	ld l,a
	call l0cc1
	inc de
	inc h
	ld a,(de)
	ld l,a
	call l0cc1
	ret
.l1185
	ld a,(ix+#03)
	neg
	and #1f
	ld (l0cee),a
	ret
.l1190
	inc hl
	ld a,(hl)
	inc hl
	ld (l0cee),a
	jp l11fb
.l1199
	inc hl
	ld a,(hl)
	inc hl
	ld b,a
	xor a
	ld (l0c5a),a
	call l0e8c
	jp l1320
.l11a7
	inc hl
	ld (ix+#2e),#01
	ld a,(hl)
	ld (ix+#19),a
	inc hl
	ld a,(hl)
	bit 7,a
	jp z,l11bd
	neg
	ld (ix+#2e),#00
.l11bd
	ld (ix+#1b),a
	ld (ix+#1e),#ff
	ld (ix+#1f),#ff
	inc hl
	jp l11fb
.l11cc
	inc hl
	ld (ix+#04),#00
	jp l11fb
.l11d4
	inc hl
	ld a,(hl)
	inc hl
	push hl
	ld h,#0d
	ld l,a
	call l0cc1
	pop hl
	jp l11fb
.l11e2
	inc hl
	jp l11fb
.l11e6
	ld a,(ix+#22)
	dec a
	ld (ix+#22),a
	jr nz,l11f5
	jp l130c
	jp l10b0
.l11f5
	ld l,(ix+#15)
	ld h,(ix+#16)
.l11fb
	ld (ix+#01),h
	ld (ix+#00),l
	jp l10b0
.l1204
	inc hl
	ld a,(hl)
	inc hl
	push hl
	ld (ix+#00),l
	ld (ix+#01),h
	ld b,a
	add a
	ld h,#00
	ld l,a
	add hl,hl
	add hl,hl
	add hl,hl
	add hl,hl
	ld de,l0508
	add hl,de
	ld d,#00
	add b
	ld e,a
	add hl,de
	ld a,(hl)
	ld (ix+#07),a
	inc hl
	ld a,(hl)
	ld (ix+#05),a
	inc hl
	ld a,(hl)
	ld (ix+#08),a
	inc hl
	ld a,(hl)
	ld (ix+#09),a
	inc hl
	ld a,(hl)
	ld (ix+#0a),a
	inc hl
	ld a,(hl)
	ld (ix+#26),a
	inc hl
	ld a,(hl)
	ld (ix+#06),a
	inc hl
	ld a,(hl)
	ld (ix+#2a),a
	inc hl
	ld a,(hl)
	ld (ix+#28),a
	inc hl
	ld a,(hl)
	ld (ix+#19),a
	inc hl
	ld a,(hl)
	ld (ix+#1b),a
	inc hl
	ld a,(hl)
	ld (ix+#1e),a
	inc hl
	ld a,(hl)
	ld (ix+#11),a
	inc hl
	ld a,(hl)
	ld (ix+#12),a
	inc hl
	ld (ix+#14),h
	ld (ix+#13),l
	ld (ix+#10),#00
	ld de,#0010
	add hl,de
	ld a,(hl)
	ld (ix+#17),#00
	and a
	jp z,l128f
	ld b,a
	or #c0
	ld (l0cef),a
	ld a,b
	bit 7,a
	jp z,l128f
	cpl
	and #38
	ld (ix+#17),a
.l128f
	inc hl
	ld a,(ix+#0f)
	cp #08
	jp nz,l12ab
	ld a,(hl)
	ld (l0c4c),a
	and a
	jp z,l12ab
	inc hl
	inc hl
	ld a,(hl)
	push hl
	ld h,#0d
	ld l,a
	call l0cc1
	pop hl
.l12ab
	pop hl
	jp l10b0
.l12af
	inc hl
	ld a,(hl)
	inc hl
	push hl
	add a
	add a
	add a
	ld h,#00
	ld l,a
	ld de,l14ce
	add hl,de
	ld (l0c4e),hl
	pop hl
	jp l1320
.l12c4
	inc hl
	ld a,(hl)
	inc hl
	ld (ix+#2c),a
	jp l1320
.l12cd
	inc hl
	ld a,(hl)
	inc hl
	ld (ix+#2b),a
	jp l1320
.l12d6
	inc hl
	ld a,(hl)
	sub #0c
	inc hl
	ld (l0d20),a
	ld (l0d4f),a
	ld (l0d7e),a
	jp l1320
.l12e7
	inc hl
	ld b,(hl)
	inc hl
	ld a,(ix+#2d)
	add b
	ld (ix+#2d),a
	jp l1320
	ld (ix+#0c),#ff
	ld (ix+#03),#00
	ld (ix+#04),#00
	inc hl
	ld a,(hl)
	and a
	jp z,l0f0c
	call l0e34
	jp l0f0c
.l130c
	call l131a
	jp l10aa
.l1312
	pop bc
	jp l0e34
.l1316
	pop bc
	jp l0d85
.l131a
	ld l,(ix+#20)
	ld h,(ix+#21)
.l1320
	ld a,(hl)
	cp #f8
	jp z,l12c4
	cp #f9
	jp z,l12cd
	cp #f6
	jp z,l1199
	cp #fa
	jp z,l12e7
	cp #fb
	jp z,l12d6
	cp #fc
	jp z,l12af
	cp #fd
	jp z,l1316
	cp #fe
	jr z,l1372
	cp #ff
	jr z,l1312
	push hl
	ld l,a
	ld h,#00
	add hl,hl
	ld de,l0773
	add hl,de
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld (ix+#00),e
	ld (ix+#01),d
	ld (ix+#15),e
	ld (ix+#16),d
	pop hl
	inc hl
	ld a,(hl)
	ld (ix+#22),a
	inc hl
	ld (ix+#20),l
	ld (ix+#21),h
	ret
.l1372
	ld l,(ix+#23)
	ld h,(ix+#24)
	jr l1320
.l137e equ $ + 4
	db #00,#00,#00,#00,#00,#00
	dw #0e18,#0d4d,#0c8e,#0bda
	dw #0b2f,#0a8f,#09f7,#0968
	dw #08e1,#0861,#07e9,#0777
	dw #070c,#06a7,#0647,#05ed
	dw #0598,#0547,#04fc,#04d4
	dw #0470,#0431,#03f4,#03dc
	dw #0386,#0353,#0324,#02f6
	dw #02cc,#02a4,#027e,#025a
	dw #0238,#0218,#01fa,#01de
	dw #01c3,#01aa,#0192,#017b
	dw #0166,#0152,#013f,#012d
	dw #011c,#010c,#00fd,#00ef
	dw #00e1,#00d5,#00c9,#00be
	dw #00b3,#00a9,#009f,#0096
	dw #008e,#0086,#007f,#0077
	dw #0071,#006a,#0064,#005f
	dw #0059,#0054,#0050,#004b
	dw #0047,#0043,#003f,#003c
	dw #0038,#0035,#0032,#002f
	dw #002d,#002a,#0028,#0026
	dw #0024,#0022,#0020,#001e
	dw #001c,#001b,#0019,#0018
	dw #0016,#0015,#0014,#0013
	dw #0012,#0011,#0010,#0000
	dw #0000,#0000,#0000,#0000
	dw #0000,#0000,#0000,#0000
	dw #0000,#0000,#0000,#0000
	dw #0000,#0000,#0000,#006a
	dw #0064,#005e,#005a,#0054
	dw #004f,#004a,#0047,#0043
	dw #003f,#003b,#0038,#0035
	dw #0032,#002f,#002d,#002a
	dw #0028,#0025,#0023,#0021
	dw #0020,#001e,#001c,#001b
	dw #0019,#0018,#0016,#0015
	dw #0014,#0013,#0012,#0011
	dw #0010,#000f,#000e,#000d
	dw #000c,#000b,#000a
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l14ce
	db #02,#04,#06,#08,#0a,#0c,#0e,#10
	db #12,#14,#16,#18,#1a,#1c,#1e,#20
	db #22,#24,#26,#28,#2a,#2c,#2e,#30
	db #32,#34,#36,#38,#3a,#3c,#3e,#40

.game_name
	db "Operation Hanoi",0
.game_year
	db "1990",0
.game_publisher
	db "Players",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"

